fix(openfeature): allow null targeting key for static and rule-only flags#10990
Conversation
…point - Remove early null targeting key guard at evaluate() entry point - Add deferred null check inside shard else-branch before matchesShard call - Static and rule-only flags can now evaluate with null targeting key - TARGETING_KEY_MISSING only returned when shard computation needs it
…rTest - Update existing test: null TK on static flag now expects success (was incorrectly expecting TARGETING_KEY_MISSING error) - Add test: null TK on sharded flag expects TARGETING_KEY_MISSING error - Add test: null TK on rule-only flag (country attribute) expects success - Add createCountryRuleFlag() helper: rule matching on 'country' attribute with no shards, validates rule evaluation works without targeting key
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 1 performance regressions! Performance is the same for 64 metrics, 6 unstable metrics.
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.076 s) : 0, 1076298
Total [baseline] (4.496 s) : 0, 4495725
Agent [candidate] (1.073 s) : 0, 1073452
Total [candidate] (11.214 s) : 0, 11213698
section appsec
Agent [baseline] (1.259 s) : 0, 1258585
Total [baseline] (11.212 s) : 0, 11211898
Agent [candidate] (1.26 s) : 0, 1259598
Total [candidate] (11.282 s) : 0, 11281765
section iast
Agent [baseline] (1.245 s) : 0, 1244521
Total [baseline] (11.48 s) : 0, 11480353
Agent [candidate] (1.244 s) : 0, 1244037
Total [candidate] (11.423 s) : 0, 11423002
section profiling
Agent [baseline] (1.2 s) : 0, 1199907
Total [baseline] (11.164 s) : 0, 11163559
Agent [candidate] (1.194 s) : 0, 1193986
Total [candidate] (11.121 s) : 0, 11120623
gantt
title petclinic - break down per module: candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.173 ms) : 0, 1173
crashtracking [candidate] (1.217 ms) : 0, 1217
BytebuddyAgent [baseline] (628.47 ms) : 0, 628470
BytebuddyAgent [candidate] (638.666 ms) : 0, 638666
AgentMeter [baseline] (29.327 ms) : 0, 29327
AgentMeter [candidate] (29.682 ms) : 0, 29682
GlobalTracer [baseline] (269.242 ms) : 0, 269242
GlobalTracer [candidate] (259.795 ms) : 0, 259795
AppSec [baseline] (34.368 ms) : 0, 34368
AppSec [candidate] (32.146 ms) : 0, 32146
Debugger [baseline] (64.338 ms) : 0, 64338
Debugger [candidate] (61.477 ms) : 0, 61477
Remote Config [baseline] (680.817 µs) : 0, 681
Remote Config [candidate] (606.971 µs) : 0, 607
Telemetry [baseline] (8.538 ms) : 0, 8538
Telemetry [candidate] (8.124 ms) : 0, 8124
Flare Poller [baseline] (4.077 ms) : 0, 4077
Flare Poller [candidate] (5.079 ms) : 0, 5079
section appsec
crashtracking [baseline] (1.226 ms) : 0, 1226
crashtracking [candidate] (1.205 ms) : 0, 1205
BytebuddyAgent [baseline] (665.3 ms) : 0, 665300
BytebuddyAgent [candidate] (665.275 ms) : 0, 665275
AgentMeter [baseline] (12.258 ms) : 0, 12258
AgentMeter [candidate] (12.228 ms) : 0, 12228
GlobalTracer [baseline] (259.895 ms) : 0, 259895
GlobalTracer [candidate] (260.754 ms) : 0, 260754
AppSec [baseline] (179.182 ms) : 0, 179182
AppSec [candidate] (179.426 ms) : 0, 179426
Debugger [baseline] (66.965 ms) : 0, 66965
Debugger [candidate] (67.02 ms) : 0, 67020
Remote Config [baseline] (645.986 µs) : 0, 646
Remote Config [candidate] (642.65 µs) : 0, 643
Telemetry [baseline] (8.409 ms) : 0, 8409
Telemetry [candidate] (8.398 ms) : 0, 8398
Flare Poller [baseline] (3.651 ms) : 0, 3651
Flare Poller [candidate] (3.575 ms) : 0, 3575
IAST [baseline] (24.316 ms) : 0, 24316
IAST [candidate] (24.367 ms) : 0, 24367
section iast
crashtracking [baseline] (1.226 ms) : 0, 1226
crashtracking [candidate] (1.219 ms) : 0, 1219
BytebuddyAgent [baseline] (807.767 ms) : 0, 807767
BytebuddyAgent [candidate] (805.585 ms) : 0, 805585
AgentMeter [baseline] (11.636 ms) : 0, 11636
AgentMeter [candidate] (11.629 ms) : 0, 11629
GlobalTracer [baseline] (250.51 ms) : 0, 250510
GlobalTracer [candidate] (252.061 ms) : 0, 252061
AppSec [baseline] (26.954 ms) : 0, 26954
AppSec [candidate] (26.981 ms) : 0, 26981
Debugger [baseline] (69.401 ms) : 0, 69401
Debugger [candidate] (70.997 ms) : 0, 70997
Remote Config [baseline] (529.141 µs) : 0, 529
Remote Config [candidate] (540.127 µs) : 0, 540
Telemetry [baseline] (10.316 ms) : 0, 10316
Telemetry [candidate] (9.192 ms) : 0, 9192
Flare Poller [baseline] (3.767 ms) : 0, 3767
Flare Poller [candidate] (3.464 ms) : 0, 3464
IAST [baseline] (25.623 ms) : 0, 25623
IAST [candidate] (25.772 ms) : 0, 25772
section profiling
ProfilingAgent [baseline] (95.467 ms) : 0, 95467
ProfilingAgent [candidate] (94.844 ms) : 0, 94844
crashtracking [baseline] (1.21 ms) : 0, 1210
crashtracking [candidate] (1.189 ms) : 0, 1189
BytebuddyAgent [baseline] (693.089 ms) : 0, 693089
BytebuddyAgent [candidate] (689.146 ms) : 0, 689146
AgentMeter [baseline] (9.039 ms) : 0, 9039
AgentMeter [candidate] (9.072 ms) : 0, 9072
GlobalTracer [baseline] (217.785 ms) : 0, 217785
GlobalTracer [candidate] (216.861 ms) : 0, 216861
AppSec [baseline] (32.665 ms) : 0, 32665
AppSec [candidate] (32.764 ms) : 0, 32764
Debugger [baseline] (66.85 ms) : 0, 66850
Debugger [candidate] (66.691 ms) : 0, 66691
Remote Config [baseline] (574.309 µs) : 0, 574
Remote Config [candidate] (575.281 µs) : 0, 575
Telemetry [baseline] (7.845 ms) : 0, 7845
Telemetry [candidate] (7.794 ms) : 0, 7794
Flare Poller [baseline] (3.597 ms) : 0, 3597
Flare Poller [candidate] (3.487 ms) : 0, 3487
Profiling [baseline] (96.023 ms) : 0, 96023
Profiling [candidate] (95.399 ms) : 0, 95399
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.061 s) : 0, 1061074
Total [baseline] (8.866 s) : 0, 8865548
Agent [candidate] (1.069 s) : 0, 1069341
Total [candidate] (8.972 s) : 0, 8971663
section iast
Agent [baseline] (1.25 s) : 0, 1249934
Total [baseline] (9.636 s) : 0, 9636129
Agent [candidate] (1.24 s) : 0, 1239522
Total [candidate] (9.599 s) : 0, 9598752
gantt
title insecure-bank - break down per module: candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.207 ms) : 0, 1207
crashtracking [candidate] (1.204 ms) : 0, 1204
BytebuddyAgent [baseline] (631.496 ms) : 0, 631496
BytebuddyAgent [candidate] (635.463 ms) : 0, 635463
AgentMeter [baseline] (29.537 ms) : 0, 29537
AgentMeter [candidate] (30.073 ms) : 0, 30073
GlobalTracer [baseline] (257.851 ms) : 0, 257851
GlobalTracer [candidate] (260.322 ms) : 0, 260322
AppSec [baseline] (31.973 ms) : 0, 31973
AppSec [candidate] (32.103 ms) : 0, 32103
Debugger [baseline] (59.965 ms) : 0, 59965
Debugger [candidate] (60.54 ms) : 0, 60540
Remote Config [baseline] (587.32 µs) : 0, 587
Remote Config [candidate] (624.637 µs) : 0, 625
Telemetry [baseline] (7.999 ms) : 0, 7999
Telemetry [candidate] (8.201 ms) : 0, 8201
Flare Poller [baseline] (4.237 ms) : 0, 4237
Flare Poller [candidate] (4.367 ms) : 0, 4367
section iast
crashtracking [baseline] (1.221 ms) : 0, 1221
crashtracking [candidate] (1.234 ms) : 0, 1234
BytebuddyAgent [baseline] (811.295 ms) : 0, 811295
BytebuddyAgent [candidate] (804.354 ms) : 0, 804354
AgentMeter [baseline] (11.681 ms) : 0, 11681
AgentMeter [candidate] (11.48 ms) : 0, 11480
GlobalTracer [baseline] (252.287 ms) : 0, 252287
GlobalTracer [candidate] (250.489 ms) : 0, 250489
AppSec [baseline] (27.121 ms) : 0, 27121
AppSec [candidate] (26.788 ms) : 0, 26788
Debugger [baseline] (67.74 ms) : 0, 67740
Debugger [candidate] (68.092 ms) : 0, 68092
Remote Config [baseline] (526.083 µs) : 0, 526
Remote Config [candidate] (535.813 µs) : 0, 536
Telemetry [baseline] (11.254 ms) : 0, 11254
Telemetry [candidate] (10.813 ms) : 0, 10813
Flare Poller [baseline] (4.047 ms) : 0, 4047
Flare Poller [candidate] (3.804 ms) : 0, 3804
IAST [baseline] (26.078 ms) : 0, 26078
IAST [candidate] (25.462 ms) : 0, 25462
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 1 performance regressions! Performance is the same for 16 metrics, 17 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section baseline
no_agent (17.988 ms) : 17805, 18171
. : milestone, 17988,
appsec (18.603 ms) : 18419, 18788
. : milestone, 18603,
code_origins (18.025 ms) : 17844, 18206
. : milestone, 18025,
iast (17.92 ms) : 17745, 18094
. : milestone, 17920,
profiling (19.543 ms) : 19343, 19742
. : milestone, 19543,
tracing (17.748 ms) : 17574, 17921
. : milestone, 17748,
section candidate
no_agent (18.174 ms) : 17990, 18358
. : milestone, 18174,
appsec (18.729 ms) : 18540, 18919
. : milestone, 18729,
code_origins (17.641 ms) : 17468, 17813
. : milestone, 17641,
iast (18.031 ms) : 17854, 18209
. : milestone, 18031,
profiling (18.707 ms) : 18522, 18892
. : milestone, 18707,
tracing (17.676 ms) : 17501, 17852
. : milestone, 17676,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section baseline
no_agent (1.226 ms) : 1214, 1238
. : milestone, 1226,
iast (3.228 ms) : 3185, 3270
. : milestone, 3228,
iast_FULL (5.993 ms) : 5932, 6054
. : milestone, 5993,
iast_GLOBAL (3.743 ms) : 3684, 3801
. : milestone, 3743,
profiling (2.259 ms) : 2239, 2279
. : milestone, 2259,
tracing (1.864 ms) : 1849, 1880
. : milestone, 1864,
section candidate
no_agent (1.241 ms) : 1228, 1253
. : milestone, 1241,
iast (3.372 ms) : 3321, 3423
. : milestone, 3372,
iast_FULL (6.165 ms) : 6101, 6229
. : milestone, 6165,
iast_GLOBAL (3.698 ms) : 3640, 3757
. : milestone, 3698,
profiling (2.21 ms) : 2190, 2230
. : milestone, 2210,
tracing (1.878 ms) : 1862, 1895
. : milestone, 1878,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section baseline
no_agent (1.48 ms) : 1469, 1492
. : milestone, 1480,
appsec (3.806 ms) : 3584, 4028
. : milestone, 3806,
iast (2.257 ms) : 2189, 2326
. : milestone, 2257,
iast_GLOBAL (2.317 ms) : 2247, 2386
. : milestone, 2317,
profiling (2.122 ms) : 2065, 2178
. : milestone, 2122,
tracing (2.073 ms) : 2019, 2126
. : milestone, 2073,
section candidate
no_agent (1.482 ms) : 1470, 1493
. : milestone, 1482,
appsec (3.799 ms) : 3577, 4020
. : milestone, 3799,
iast (2.262 ms) : 2193, 2332
. : milestone, 2262,
iast_GLOBAL (2.31 ms) : 2241, 2380
. : milestone, 2310,
profiling (2.118 ms) : 2061, 2175
. : milestone, 2118,
tracing (2.068 ms) : 2015, 2122
. : milestone, 2068,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.61.0-SNAPSHOT~1c8b32c8d8, baseline=1.61.0-SNAPSHOT~c2e48350d7
dateFormat X
axisFormat %s
section baseline
no_agent (14.968 s) : 14968000, 14968000
. : milestone, 14968000,
appsec (14.88 s) : 14880000, 14880000
. : milestone, 14880000,
iast (18.457 s) : 18457000, 18457000
. : milestone, 18457000,
iast_GLOBAL (17.994 s) : 17994000, 17994000
. : milestone, 17994000,
profiling (14.892 s) : 14892000, 14892000
. : milestone, 14892000,
tracing (14.942 s) : 14942000, 14942000
. : milestone, 14942000,
section candidate
no_agent (15.494 s) : 15494000, 15494000
. : milestone, 15494000,
appsec (14.703 s) : 14703000, 14703000
. : milestone, 14703000,
iast (18.349 s) : 18349000, 18349000
. : milestone, 18349000,
iast_GLOBAL (17.799 s) : 17799000, 17799000
. : milestone, 17799000,
profiling (14.824 s) : 14824000, 14824000
. : milestone, 14824000,
tracing (14.927 s) : 14927000, 14927000
. : milestone, 14927000,
|
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
typotter
left a comment
There was a problem hiding this comment.
lgtm for flagging/spec. Suggest doing a docs search for any updates needed to targetingKey references
| return error(defaultValue, ErrorCode.INVALID_CONTEXT); | ||
| } | ||
|
|
||
| if (context.getTargetingKey() == null) { |
| return resolveVariant( | ||
| target, key, defaultValue, flag, split.variationKey, allocation, context); | ||
| } else { | ||
| if (targetingKey == null) { |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
b7fb6fc
into
master
Motivation
The OpenFeature spec (3.1.1) declares that evaluation context — including
targetingKey— is optional. However,DDEvaluatorcurrently rejects ALL flag evaluations when targeting key is null, returningTARGETING_KEY_MISSINGeven for static flags that don't need one.This means a simple call like:
fails with
TARGETING_KEY_MISSINGeven when the flag is configured with a static default value.Expected behavior (after this fix)
targetingKeyabsenttargetingKeypresentTARGETING_KEY_MISSINGerrorTARGETING_KEY_MISSINGis only returned when the flag genuinely needs a targeting key (i.e., shard evaluation requires it for hashing).Fixes the Java portion of the cross-SDK targeting key bug (FFL-1729).
Changes
DDEvaluator.evaluate()entry point (was at lines 90-92)TARGETING_KEY_MISSINGis only returned when shard computation actually needs the targeting keyTARGETING_KEY_MISSINGerrorcountryattribute, notid) expects successcreateCountryRuleFlag()test helper for the rule-only flag test caseDecisions
elsebranch of the split loop (where shards exist), not before the split loop. This ensures static splits (no shards) still return the variant without needing a targeting key.countryattribute (notid) to avoid theid-> targeting key fallback inresolveAttribute(), ensuring the test validates rule matching independent of targeting key.